
const sidebar = {
    namespaced: true,
    state: () => ({
        Menu: [],
        OpenNames: []
    }),
    mutations:{
        UPDATE_MENU: (state,payload) => {
            //console.log(payload)
            state.Menu = payload.Menu;
            state.OpenNames = payload.OpenNames;
        },
        UPDATE_OPEN_MENU:(state,payload) => {
            state.OpenNames = payload;
        }
    },
    actions:{
        InitSideBar({commit},payload){
            commit('UPDATE_MENU',payload);
        },
        ChangeSideBar({commit},payload){
            commit('UPDATE_MENU',payload);
        },
        ChangeOpenMenu({commit},payload){
            commit('UPDATE_OPEN_MENU',payload)
        }
    },
    getters:{
        Menu: state => {state.Menu},
        OpenNames: state => {state.OpenNames}
    }
}

export default sidebar